load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
    name = "streampb_proto",
    srcs = ["stream.proto"],
    strip_import_prefix = "/pkg",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/jobs/jobspb:jobspb_proto",
        "//pkg/kv/kvpb:kvpb_proto",
        "//pkg/roachpb:roachpb_proto",
        "//pkg/sql/catalog/descpb:descpb_proto",
        "//pkg/util:util_proto",
        "//pkg/util/hlc:hlc_proto",
        "@com_github_gogo_protobuf//gogoproto:gogo_proto",
        "@com_google_protobuf//:duration_proto",
    ],
)

go_proto_library(
    name = "streampb_go_proto",
    compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"],
    importpath = "github.com/cockroachdb/cockroach/pkg/repstream/streampb",
    proto = ":streampb_proto",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/jobs/jobspb",
        "//pkg/kv/kvpb",
        "//pkg/roachpb",
        "//pkg/sql/catalog/descpb",
        "//pkg/util",
        "//pkg/util/hlc",
        "//pkg/util/uuid",  # keep
        "@com_github_gogo_protobuf//gogoproto",
    ],
)

go_library(
    name = "streampb",
    srcs = [
        "empty.go",
        "streamid.go",
    ],
    embed = [":streampb_go_proto"],
    importpath = "github.com/cockroachdb/cockroach/pkg/repstream/streampb",
    visibility = ["//visibility:public"],
    deps = ["//pkg/util/syncutil"],
)
